<?php

abstract class DrugActiveRecord extends CActiveRecord {

    /**
     * Prepares time_add and user_add_id attributes before performing validation.
     */
    protected function beforeValidate() {
        //parent::beforeValidate();

        if ($this->isNewRecord) {
            // set the create date, last updated date and the user doing the creating  
            $this->time_add = new CDbExpression('NOW()');
            $this->user_add_id = Yii::app()->user->id;
        } 

        return parent::beforeValidate();
        //return true;
    }

}
